package cn.edu.hgu.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	public HttpServletRequest getRequest() {
		return ServletActionContext.getRequest();
	}

	public HttpServletResponse getResponse() {
		return ServletActionContext.getResponse();
	}

	public HttpSession getSession() {
		return ServletActionContext.getRequest().getSession();
	}

	public void setValueStack(String key, Object value) {
		ActionContext.getContext().getValueStack().set(key, value);
	}

	public void pushValueStack(Object obj) {
		ActionContext.getContext().getValueStack().push(obj);
	}
	
	public void putContext(String key, Object value) {
		ActionContext.getContext().put(key, value);
	}
	
}
